<!--
  @author heguanghua
  @since 2019/06/12 11:57
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<body>


<div class="layui-fluid">

    <blockquote class="layui-crumb">
        <a lay-href="/service/tariff/list.action">价格表管理&nbsp;&nbsp;</a>/&nbsp;
        <span th:text="${faultTariff.tariffName}"></span>&nbsp;&nbsp;/&nbsp;
        <span th:text="${servCategory.name}"></span>&nbsp;&nbsp;/&nbsp;
        <span th:text="${baseCategory.name}"></span>&nbsp;&nbsp;/&nbsp;
        <span>快速设置保修信息</span>
    </blockquote>

    <div class="layui-card">

        <!--<div th:replace="fault/item/_batchtab::tab"></div>-->

        <div class="layui-card-body">
            <form method="POST" action="" class="layui-form" lay-filter="zmn-form">

                <input type="hidden" name="bizType" th:value="${faultTariff.bizType}"/>
                <input type="hidden" name="tariffId" th:value="${faultTariff.tariffId}"/>
                <input type="hidden" name="servCategId" th:value="${servCategory.categId}"/>
                <input type="hidden" name="categOneId" th:value="${baseCategory.categId}"/>
                <input type="hidden" name="itemIds" th:value="${itemIds}"/>

                <div class="layui-card-header" style="margin-top:10px;"><b>基本保修信息</b></div>
                <div class="layui-split">&nbsp;</div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">保修规则：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="ruleId" lay-filter="ruleId" value="1" title="不保修"
                               th:checked="${obj.warrantyInfoId == null || obj.ruleId == 1}">
                        <input type="radio" name="ruleId" lay-filter="ruleId" value="2" title="整机保修" th:checked="${obj.ruleId == 2}">
                        <input type="radio" name="ruleId" lay-filter="ruleId" value="3" title="同性质且同部位故障" th:checked="${obj.ruleId == 3}">
                        <input type="radio" name="ruleId" lay-filter="ruleId" value="4" title="安装引起的故障" th:checked="${obj.ruleId == 4}">
                        <input type="radio" name="ruleId" lay-filter="ruleId" value="5" title="清洗引起的故障" th:checked="${obj.ruleId == 5}">
                        <input type="radio" name="ruleId" lay-filter="ruleId" value="6" title="同性质故障" th:checked="${obj.ruleId == 6}">
                    </div>
                </div>

                <div id="warrantDuration" class="layui-form-item">
                    <label class="layui-form-label">保修时长：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <select name="warrantDuration" xm-select="warrantDuration" xm-select-height="30px">
                        </select>
                    </div>
                    <span style="color: #999;" class="layui-form-mid">单位：天</span>
                </div>

                <div id="warrantyContent" class="layui-form-item">
                    <label class="layui-form-label">保修内容：</label>
                    <div class="layui-input-block">
                        <zmn th:each="item:${warrantyContents}">
                            <input type="checkbox" name="warrantyContent" lay-filter="warrantyContent" th:title="${item.content}"
                                   th:value="${item.warrantyContentId}" th:checked="${obj.warrantyContentIdStr != null && obj.warrantyContentIdStr.indexOf('$'+item.warrantyContentId+'$')!=-1}">
                        </zmn>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">应用分类：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <select id="categIds" name="categIds"  xm-select="categIds" xm-select-height="30px">
                        </select>
                    </div>
                </div>

                <div id="extendAllDiv">
                    <div class="layui-card-header" style="margin-top:10px;"><b>其他保修信息</b></div>
                    <div class="layui-split">&nbsp;</div>

                    <div class="layui-form-item" id="extendTypeDiv">
                        <label class="layui-form-label layui-form-required">延长保修：</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="extendType" lay-filter="extendType" value="2" title="延长"
                                   th:checked="${obj.extendType == null || obj.extendType == 2}">
                            <input type="radio" name="extendType" lay-filter="extendType" value="1" title="不延长" th:checked="${obj.extendType == 1}">
                        </div>
                        <span style="color: #999;" class="layui-form-mid">作为基础配置，前端根据需要获取</span>
                    </div>

                    <div class="layui-form-item" id="extendedDurationDiv">
                        <label class="layui-form-label">延长时长：</label>
                        <div class="layui-input-inline">
                            <input type="number" name="extendedDuration" autocomplete="off" maxlength="10" class="layui-input"
                                   th:value="${obj.extendedDuration}"
                                   lay-verify="isPositiveNumber"
                                   onkeyup="if(this.value.length>7) this.value=this.value.slice(0,8);value=value.replace(/^(0+)|[^\d]+/g,'')">
                        </div>
                        <div class="layui-form-mid layui-word-aux">单位：天，输入限制为正整数</div>
                    </div>
                </div>

                <div class="layui-form-item submit">
                    <div class="layui-input-block" style="margin-left: 139px">
                        <button th:if="${#authPermit.checkPermit('/service/item/batchAddEditWarrantyInfo.action')}" class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary"
                                onclick="layui.admin.events.closeThisTabs();">取消
                        </button>
                    </div>
                </div>
            </form>

        </div>

    </div>

</div>
</body>
</html>

<script type="text/javascript" th:inline="javascript">

    var json = {
        obj: [[${obj}]],
        servCategId: [[${servCategory.categId}]],
        categOneId: [[${baseCategory.categId}]],
        tariffId: [[${faultTariff.tariffId}]],
        categIds: [[${categTwos}]]
    };

    layui.config({
        base: "/static/lay/",
        version: 20200511
    }).extend({
        index: "lib/index",
        serv_service_item_batch_warranty_info_detail: "service/item/serv.service.item.batch.warranty.info.detail"
    }).use(['index', 'serv_service_item_batch_warranty_info_detail']);

</script>
